package edu.ynu.se.xiecheng.achitectureclass.nongye.entity;

import edu.ynu.se.xiecheng.achitectureclass.common.entity.LogicEntity;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import java.time.LocalDateTime;  // 使用 LocalDateTime 类型

@Getter
@Setter
@Entity
@DynamicUpdate
@Table(name = "greenhouse")
public class Greenhouse extends LogicEntity {

    @Column(name = "boxNo", nullable = false, length = 20, unique = true)
    private String boxNo;

    @Column(name = "name", nullable = false, length = 100)
    private String name;

    @Column(name = "address", nullable = false, length = 255)
    private String address;

    @Column(name = "area", length = 50)
    private String area;

    // 修改为 LocalDateTime，使用默认值 CURRENT_TIMESTAMP
    @Column(name = "time", nullable = true, columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP")
    private LocalDateTime time;
}
